package com.i_art_engineer.meigong.photo.jigsaw;

import android.content.Context;

import java.util.List;

public class JigsawTemplate
{

    /**
     * 获取单个SlotView的Entity
     * @param context
     * @param type
     * @param position
     * @return
     */
    public static JigsawTemplateEntity getEntity(Context context, JigsawType type, int position)
    {
        if(null == type)
        {
            return null;
        }

        List<JigsawTemplateEntity> entities = JigsawParser.getInstance(context).getEntityList(type);
        if(position < 0 || position >= entities.size())
        {
            return null;
        }

        return entities.get(position);
    }

    /**
     * 根据size大小判断JigsawType值
     * @param size
     * @return
     */
    public static JigsawType getJigsawType(int size)
    {
        JigsawType jigsawType = null;
        switch(size)
        {
        case 1:
            jigsawType = JigsawType.ONE_PHOTO;
            break;
        case 2:
            jigsawType = JigsawType.TWO_PHOTO;
            break;
        default:
            jigsawType = JigsawType.NONE;
            break;
        }

        return jigsawType;
    }

}
